👀 Reading hidden code
👀 Reading hidden code
using HypertextLiteral
: @htl, @htl_str
👀 Reading hidden code
using JSON
1:100
👀 Reading hidden code
x = 1:100
1.0
1.41421
1.73205
2.0
2.23607
2.44949
2.64575
2.82843
3.0
3.16228
3.31662
3.4641
3.60555
3.74166
3.87298
4.0
4.12311
4.24264
4.3589
4.47214
9.53939
9.59166
9.64365
9.69536
9.74679
9.79796
9.84886
9.89949
9.94987
10.0
👀 Reading hidden code
👀 Reading hidden code
@htl("""
<script src="https://cdn.jsdelivr.net/npm/d3@6.2.0/dist/d3.min.js"></script>
<script id="hello">
const setup = this == null
const svg = setup ? DOM.svg(600,200) : this
const s = setup ? d3.select(svg).append("g"): this.s
if(setup) {
s.append("g").classed("axes",true)
s.append("g").classed("graph",true)
}
const height = 200
const width = 600
const margin = ({top: 20, right: 30, bottom: 30, left: 40})
const on_setup = () => {
}
const on_update = () => {
}
const x = d3.scaleLinear()
.domain(d3.extent(raw_x))
.range([margin.left, width - margin.right])
👀 Reading hidden code
👀 Reading hidden code
👀 Reading hidden code
100
400
dot_positions = [100, 400]
👀 Reading hidden code
@htl("""
<script src="https://cdn.jsdelivr.net/npm/d3@6.2.0/dist/d3.min.js"></script>
<script id="hello">
const positions = $(JSON.json(dot_positions))
const svg = this == null ? DOM.svg(600,200) : this
const s = this == null ? d3.select(svg) : this.s
s.selectAll("circle")
.data(positions)
.join("circle")
.transition()
.duration(300)
.attr("cx", d => d)
.attr("cy", 100)
.attr("r", 10)
.attr("fill", "gray")
const output = svg
output.s = s
return output
</script>
""")
👀 Reading hidden code